Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.UI
Imports System.Web.UI.WebControls

Public Class ShipMethodClass : Inherits Page
  Public ShipMethod as DropDownList
  Public YouSelected as Label 
  Public PlaceOrder as Button
  
  Sub Page_Load(Source As Object, E As EventArgs)

    if not isPostBack

      Dim myConnection As SQLConnection
      Dim myCommand As SQLCommand
      Dim myReader  As SQLDataReader
      Dim SQL       As String
      Dim ConnStr   As String

      SQl = "select * from Shippers"
      ConnStr = "server=localhost;uid=sa;pwd=;database=Northwind"

      myConnection = New SQLConnection(ConnStr)
      myConnection.Open()

      myCommand = New SQLCommand(SQL, myConnection)

      myReader = myCommand.ExecuteReader()

      While myReader.Read()
        ShipMethod.Items.Add(New ListItem(myReader.Item("CompanyName"), _
                                  myReader.Item("ShipperID")))
      End While

    end if

  End Sub

  Sub PlaceOrder_click(Source As Object, E As EventArgs) 

    YouSelected.Text = "Your order will be delivered via " & _
                       ShipMethod.SelectedItem.Text

  End Sub

End Class
